package com.ticket.sass.admin.dto.output.feature;

import com.baomidou.mybatisplus.annotation.TableField;
import com.ticket.sass.admin.model.KeyInfoModel;
import com.ticket.sass.common.entity.tenant.AppEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author ywb
 * @date 2024-03-15 10:34
 */
@Data
@ApiModel
public class AppListOutput {
    @ApiModelProperty(value = "名称，最多15个中文字")
    private Long id;
    
    @ApiModelProperty(value = "名称，最多15个中文字")
    private String name;
    
    @ApiModelProperty(value = "应用类型：1优惠券，2会员，3卖品配送，4电子检票，5先看后付，6售后服务")
    private Short type;
    
    @ApiModelProperty(value = "描述")
    @TableField("\"desc\"")
    private String desc;
    
    @ApiModelProperty(value = "封面")
    private String cover;
    
    @ApiModelProperty(value = "封面模型")
    private KeyInfoModel coverModel;
    
    @ApiModelProperty(value = "是否启用")
    private Boolean enable = false;
    
    public AppListOutput() {
    }
    
    public AppListOutput(AppEntity appEntity) {
        this.id = appEntity.getId();
        this.name = appEntity.getName();
        this.type = appEntity.getType().getValue();
        this.desc = appEntity.getDesc();
        this.cover = appEntity.getCover();
    }
    
    public KeyInfoModel getCoverModel() {
        return new KeyInfoModel(cover);
    }
}
